<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" /> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no" />
<title>添加商品</title>

	 <!-- Bootstrap -->
    <link href="<%=request.getContextPath()%>/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/static/css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/static/css/jumbotron.css" rel="stylesheet">
    
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="<%=request.getContextPath()%>/static/js/html5shiv.min.js"></script>
      <script src="<%=request.getContextPath()%>/static/js/respond.min.js"></script>
    <![endif]-->



<style type="text/css">
<!--
.STYLE6 {
	font-family: "华文行楷";
	font-size: 36px;
	color: #000000;
}
-->
</style>
<script type="text/javascript">
function validateForm() {
	var inputName = document.getElementById("name");
	var inputDescription = document.getElementById("description");
	var inputPrice = document.getElementById("price");
	var inputInventory = document.getElementById("inventory");
	
	if (inputName.value == "") {
		alert("药品名称不能为空！");
		inputName.focus();
		return false;
	}
	
	if (inputDescription.value == "") {
		alert("药品描述不能为空！");
		inputDescription.focus();
		return false;
	}
	
	if (inputPrice.value == "") {
		alert("价格不能为空！");
		inputPrice.focus();
		return false;
	}
	
	if (inputInventory.value == "") {
		alert("库存量不能为空！");
		inputInventory.focus();
		return false;
	}
	
	return true;
}
</script>
</head>

<body>


    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="<%=request.getContextPath()%>/">本草纲目网</a>
        </div>
        
		<div id="navbar" class="navbar-collapse collapse">
		  <ul class="nav navbar-nav navbar-right">
		    <li><a>欢迎您，<b>${fn:escapeXml(admin.username) }</b>！</a></li>
		    <li><a href="<%=request.getContextPath() %>/Account/AdminLogout">管理员注销</a></li>
		  </ul>
  		</div>

      </div>
    </nav>
	
	<div class="container" style="margin-top:51px;">
	  <div class="row" style="text-align:center">
	    <img src="<%=request.getContextPath()%>/static/image/adddrugtitle.jpg" width="310" height="152"/>
	  </div>
	
	  <div class="row" style="text-align:center">
	    <p class="STYLE6">添加药品</p>
	  </div>
	
	  <div class="row">
	    <div class="col-sm-1 col-md-2 col-lg-3"></div>
		<div class="col-xs-12 col-sm-10 col-md-8 col-lg-6">
		  <form class="form-horizontal" method="post" onsubmit="return validateForm();">
		    <div class="form-group" style="padding:0px 15px 0px 15px;">
			  <label for="name" class="control-label">药品名称：</label>
			  <input type="text" class="form-control" name="goodname" id="name" placeholder="请添加药品名称">
			</div>
		  
		    <div class="form-group" style="padding:0px 15px 0px 15px;">
			  <label for="description" class="control-label">药品描述：</label>
			  <input type="text" class="form-control" name="gooddescription" id="description" placeholder="请添加药品描述">
			</div>
			
			<div class="form-group" style="padding:0px 15px 0px 15px;">
			  <label for="price" class="control-label">药品价格：</label>
			  <input type="text" class="form-control" name="goodprice" id="price" placeholder="请添加药品价格">
			</div>
			
			<div class="form-group" style="padding:0px 15px 0px 15px;">
			  <label for="inventory" class="control-label">药品库存：</label>
			  <input type="text" class="form-control" name="goodinventory" id="inventory" placeholder="请添加药品库存">
			</div>
			
			<div class="row">
			  <c:if test="${errCode eq 1 }">
			    <div class="alert alert-warning" role="alert" id="alert-warning">名称或描述未填写！</div>
			  </c:if>
			  <c:if test="${errCode eq 2 }">
			    <div class="alert alert-warning" role="alert" id="alert-warning">价格或库存量的格式有误！</div>
			  </c:if>
			  <c:if test="${errCode eq 3 }">
			    <div class="alert alert-warning" role="alert" id="alert-warning">价格必须为不大于10000000的正数！</div>
			  </c:if>
			  <c:if test="${errCode eq 4 }">
			    <div class="alert alert-warning" role="alert" id="alert-warning">库存量必须为不大于10000000的正数！</div>
			  </c:if>
			</div>
			
			<div class="form-group" style="text-align:center">
			  <button type="submit" class="btn btn-lg btn-primary">添加</button>
			</div>
		  </form>
		</div>
	  </div>

      <footer style="padding-top:19px;color:#777;border-top:1px solid #e5e5e5">
        <p>&copy; 2016 中国药科大学理学院信息管理与信息系统13480班第3组</p>
      </footer>
	
	</div>

<script src="<%=request.getContextPath()%>/static/js/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="<%=request.getContextPath()%>/static/js/bootstrap.min.js"></script>
</body>
</html>
